﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace FCRE
{
    class LogHelper
    {
        public static void WriteLog(string log)
        {
            try
            {
                string logpath = AppDomain.CurrentDomain.BaseDirectory + "logs";
                if (!Directory.Exists(logpath)) Directory.CreateDirectory(logpath);
                File.AppendAllText(logpath + @"\" + DateTime.Now.ToString("yyyy-MM-dd") + ".log", DateTime.Now.ToString("HH:mm:ss") + "  " + log + Environment.NewLine);
            }catch(Exception ex) { }
        }

        public static void WriteLog(Type a,string log)
        {
            try
            {
                string logpath = AppDomain.CurrentDomain.BaseDirectory + "logs";
            if (!Directory.Exists(logpath)) Directory.CreateDirectory(logpath);
            File.AppendAllText(logpath + @"\" + DateTime.Now.ToString("yyyy-MM-dd") + ".log", DateTime.Now.ToString("HH:mm:ss") + "  ["+a.Name+ "] "+ log + Environment.NewLine);
            }
            catch (Exception ex) { }
        }
    }
}
